<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

//轮播
Route::get('api/:version/banner/:id', 'api/:version.Banner/getBanner');
//精选
Route::group('api/:version/theme', function () {
    Route::get('/', 'api/:version.Theme/getSimpleLIst');
    Route::get('/:id', 'api/:version.Theme/getComplexOne');
    Route::post(':t_id/product/:p_id', 'api/:version.Theme/addThemeProduct');
    Route::delete(':t_id/product/:p_id', 'api/:version.Theme/deleteThemeProduct');
});
//产品
Route::group('api/:version/product', function () {
    Route::get('/recent', 'api/:version.Product/getRecent');
    Route::get('/:id', 'api/:version.Product/getOne', [], ['id' => '\d+']);
    Route::get('/by_category', 'api/:version.Product/getAllInCategory');
});
Route::get('api/:version/category/all', 'api/:version.Category/getAllCategories');
//Token
Route::group('api/:version/token',function (){
    Route::post('/user', 'api/:version.Token/getToken');
    Route::post('/verify', 'api/:version.Token/verifyToken');
    Route::post('/app', 'api/:version.Token/getAppToken');
} );

//地址
Route::group('api/:version/address', function () {
    Route::post('/', 'api/:version.Address/createOrUpdateAddress');
    Route::get('/', 'api/:version.Address/getUserAddress');
});
//下单
Route::group('api/:version/order', function () {
    Route::post('/', 'api/:version.Order/placeOrder');
    Route::get('/by_user', 'api/:version.Order/getSummaryByUser');
    Route::post('/:id', 'api/:version.Order/getDetail', [], ['id' => '\d+']);

    Route::get('/paginate', 'api/:version.Order/getSummary');
    Route::put('/delivery', 'api/:version.Order/delivery');
});
//支付
Route::post('api/:version/pay/pre_order', 'api/:version.Pay/getPreOrder');
//微信回调
Route::post('api/:version/pay/notify', 'api/:version.Pay/reciveNotify');


